
import java.text.ParseException;
import java.text.SimpleDateFormat;
        import java.util.Date;

public class Person {
    private String name;
    private Date birthday;

    public Person(String name, Date birthday) {
        this.name = name;
        this.birthday = birthday;
    }

    public int compareBirthday(Person person) {
        return this.birthday.compareTo(person.getBirthday());
    }

    public int betweenDay(Person person) {
        long diff = Math.abs(this.birthday.getTime() - person.getBirthday().getTime());
        return (int) (diff / (24 * 60 * 60 * 1000));
    }

    public void displayInfo() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
        String formattedBirthday = sdf.format(birthday);
        System.out.println("姓名：" + name);
        System.out.println("生日：" + formattedBirthday);
    }

    public Date getBirthday() {
        return birthday;
    }
}
class Main {
    public static void main(String[] args) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        try {
            Date birthday1 = sdf.parse("1990-01-01");
            Date birthday2 = sdf.parse("1995-05-10");

            Person person1 = new Person("Alice", birthday1);
            Person person2 = new Person("Bob", birthday2);

            int ageComparison = person1.compareBirthday(person2);
            System.out.println("年龄大小关系：" + ageComparison);

            int daysDifference = person1.betweenDay(person2);
            System.out.println("生日相差天数：" + daysDifference);

            person1.displayInfo();
            person2.displayInfo();
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
}